package com.windy.kafka.sender.annotation.context;


import com.windy.kafka.sender.annotation.header.TracingHeaders;

/**
 * Created by liyufeng on 2022/5/8
 */
public class HeaderContextHolder {
    private static volatile ContextHolderStrategy<TracingHeaders> strategy = new ThreadLocalContextHolderStrategy<TracingHeaders>();

    public static TracingHeaders getHeader() {
        return strategy.getContext();
    }

    public static void setHeader(TracingHeaders header) {
        strategy.setContext(header);
    }

    public static void clear() {
        strategy.clearContext();
    }

    public void setStrategy(ContextHolderStrategy<TracingHeaders> strategy) {
        HeaderContextHolder.strategy = strategy;
    }


}
